<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的订单</title>
    <link rel="stylesheet" href="__STATIC__/index/assets/sui/dist/css/sm.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_2008579_4jc01siy42m.css">
    <link rel="stylesheet" href="__STATIC__/index/assets/css/index.css">
    <link rel="stylesheet" href="__STATIC__/index/assets/sui/dist/css/sm-extend.min.css">
    <style>
        a{
            color: #6d6d72;
        }
    </style>
</head>

<body>
<!-- page 容器 -->
<div class="page">
    <header class="bar bar-nav">
        <h1 class="title">我的订单</h1>
    </header>
    <!-- 工具栏 -->
    <nav class="bar bar-tab">
        <a class="tab-item external" href="{:url('index/index')}">
            <span class="icon icon-home"></span>
            <span class="tab-label">首页</span>
        </a>
        <a class="tab-item external" href="{:url('orderhall/index')}">
            <span class="icon iconfont icondating"></span>
            <span class="tab-label">大厅</span>
        </a>
        <a class="tab-item external active" href="{:url('myorder/index')}">
            <span class="icon iconfont icondingdan"></span>
            <span class="tab-label">订单</span>
        </a>
        <a class="tab-item external" href="{:url('user/index')}">
            <span class="icon icon-me"></span>
            <span class="tab-label">我的</span>
        </a>
    </nav>
    <div class="content">
        <div class="buttons-tab">
            <a href="#tab1" class="tab-link active button">进行中</a>
            <a href="#tab2" class="tab-link button">待付款</a>
            <a href="#tab3" class="tab-link button">已完成</a>
            {if $userStatus==2}
            <a href="#tab4" class="tab-link button">接 单</a>
            {/if}
        </div>
        <div class="content-block order_list">
            <div class="tabs">
                <div id="tab1" class="tab active">
                    {if !$order['payed']}
                    <div class="content-block order_list">
                        <img class="no_order" src="__STATIC__/index/assets/image/no_order.png" alt="">
                        <p class="no_order_tit">暂无订单</p>
                    </div>
                    {else /}
                    <div class="content-block order_list">
                        {foreach $order['payed'] as $k=>$v}
                        <a href="{:url('showOrder',['order_id'=>$v['order_id']])}">
                        <div class="card">
                            <div class="card-header">{$v['order_title']}<span class="icon icon-right"></span></div>
                            <div class="card-content">
                                <div class="card-content-inner">
                                    <div class="order_cont">
                                        <div class="order_l">
                                            <div><span>订单号</span>{$v['order_num']}</div>
                                            <div><span>配送费</span> {$v['order_price']}元</div>
                                            <div>创建时间：{:date('Y-m-d H:i:s',$v['order_ctime'])}</div>
                                        </div>
                                        <span class="order_r"><img src="__STATIC__/index/assets/image/jinxing.png" alt=""></span>
                                    </div>

                                </div>
                                <div class="card-footer order_foot">￥{$v.order_price}</div>
                            </div>
                        </div>
                        </a>
                        {/foreach}
                    </div>
                    {/if}
                </div>
                <div id="tab2" class="tab">
                    {if !$order['nopayed']}
                    <div class="content-block order_list">
                        <img class="no_order" src="__STATIC__/index/assets/image/no_order.png" alt="">
                        <p class="no_order_tit">暂无订单</p>
                    </div>
                    {else /}
                    <div class="content-block order_list">
                        {foreach $order['nopayed'] as $k=>$v}
                        <a href="{:url('showOrder',['order_id'=>$v['order_id']])}">
                        <div class="card">
                            <div class="card-header">{$v['order_title']}<span class="icon icon-right"></span></div>
                            <div class="card-content">
                                <div class="card-content-inner">
                                    <div class="order_cont">
                                        <div class="order_l">
                                            <div><span>订单号</span>{$v['order_num']}</div>
                                            <div><span>配送费</span> {$v['order_price']}元</div>
                                            <div>创建时间：{:date('Y-m-d H:i:s',$v['order_ctime'])}</div>
                                        </div>
                                        <span class="order_r"><img class="order_topay" src="__STATIC__/index/assets/image/topay.png" alt=""></span>
                                    </div>
                                </div>
                                <div class="card-footer order_foot">￥{$v.order_price}</div>
                            </div>
                        </div>
                        </a>
                        {/foreach}
                    </div>
                    {/if}
                </div>
                <div id="tab3" class="tab">
                    {if !$order['over']}
                    <div class="content-block order_list">
                        <img class="no_order" src="__STATIC__/index/assets/image/no_order.png" alt="">
                        <p class="no_order_tit">暂无订单</p>
                    </div>
                    {else /}
                    <div class="content-block order_list">
                        {foreach $order['over'] as $k=>$v}
                        <a href="{:url('showOrder',['order_id'=>$v['order_id']])}">
                            <div class="card">
                                <div class="card-header">{$v['order_title']}<span class="icon icon-right"></span></div>
                                <div class="card-content">
                                    <div class="card-content-inner">
                                        <div class="order_cont">
                                            <div class="order_l">
                                                <div><span>订单号</span>{$v['order_num']}</div>
                                                <div><span>配送费</span> {$v['order_price']}元</div>
                                                <div>创建时间：{:date('Y-m-d H:i:s',$v['order_ctime'])}</div>
                                            </div>
                                            <span class="order_r"><img class="order_topay" src="__STATIC__/index/assets/image/over.png" alt=""></span>
                                        </div>
                                    </div>
                                    <div class="card-footer order_foot">￥{$v.order_price}</div>
                                </div>
                            </div>
                        </a>
                        {/foreach}
                    </div>
                    {/if}
                </div>
                <div id="tab4" class="tab">
                    {if !$order['tuple']}
                    <div class="content-block order_list">
                        <img class="no_order" src="__STATIC__/index/assets/image/no_order.png" alt="">
                        <p class="no_order_tit">暂无订单</p>
                    </div>
                    {else /}
                    <div class="content-block order_list">
                        {foreach $order['tuple'] as $k=>$v}
                        <a href="{:url('showOrder',['order_id'=>$v['order_id']])}">
                            <div class="card">
                                <div class="card-header">{$v['order_title']}<span class="icon icon-right"></span></div>
                                <div class="card-content">
                                    <div class="card-content-inner">
                                        <div class="order_cont">
                                            <div class="order_l">
                                                <div><span>订单号</span>{$v['order_num']}</div>
                                                <div><span>配送费</span> {$v['order_price']}元</div>
                                                <div>下单人：{$v['userMsg']['user_name']}</div>
                                                <div>下单地址：{$v['userMsg']['user_address']}</div>
                                                <div>下单备注：{$v['order_content']}</div>
                                                <div>创建时间：{:date('Y-m-d H:i:s',$v['order_ctime'])}</div>
                                            </div>
                                            <span class="order_r"></span>
                                        </div>
                                    </div>
                                    <div class="card-footer order_foot">￥{$v.order_price}
                                        {if $v.order_status==2}
                                         <a href="" onclick="overOrder({$v.order_num})" class="button pull-right">完成订单</a>
                                        {/if}
                                        {if $v.order_status==3}
                                        <a href=""  class="button button-success pull-right">已完成</a>
                                        {/if}
                                    </div>
                                </div>
                            </div>
                        </a>
                        {/foreach}
                    </div>
                    {/if}
                </div>
            </div>
        </div>
    </div>
</div>
<script src='http://cdn.bootcss.com/jquery/3.1.1/jquery.min.js'></script>
<script src=' __STATIC__/index/assets/sui/dist/js/sm.js'></script>
<script type='text/javascript' src='__STATIC__/index/assets/sui/dist/js/sm-extend.js' charset='utf-8'></script>
<script>
    function overOrder(order_num) {
        $.ajax({
            url: "{:url('order/overOrder')}",
            type: "POST",
            data: {
                order_num:order_num
            },
            dataType: "json",
            success: function(res){
                if(res.code){
                    $.toast(res.msg,2000);

                }else {
                    $.toast(res.msg,2000);
                }
                setTimeout(function () {
                    location.reload();
                },2000)
            }
        });
    }
</script>
</body>

</html>